From 86c3274579fed906137fb538e411643e3879fdf3 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 7 Sep 2012 14:35:56 -0500 Subject: [PATCH] Connect to location-selected on the places sidebar, and actually switch folders\! Signed-off-by: Federico Mena Quintero --- gtk/gtkfilechooserdefault.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index b355c68944..1eb6736dd5 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -17,6 +17,13 @@ * License along with this library. If not, see . */ +/* TODO: + * + * * Fix instances of "#if REMOVE_FOR_PLACES_SIDEBAR" + * + * * Fix FIXME-places-sidebar + */ + #include "config.h" #include "gtkfilechooserdefault.h" @@ -3737,12 +3744,42 @@ shortcuts_pane_create (GtkFileChooserDefault *impl, } #endif +static void +places_sidebar_location_selected_cb (GtkPlacesSidebar *sidebar, GFile *location, GtkPlacesOpenMode open_mode, GtkFileChooserDefault *impl) +{ + gboolean clear_entry; + + /* FIXME-places-sidebar: see shortcuts_activate_iter() for missing pieces. In particular: + * + * * Search mode + * + * * Recent-files mode + */ + + /* In the Save modes, we want to preserve what the uesr typed in the filename + * entry, so that he may choose another folder without erasing his typed name. + */ + if (impl->location_entry + && !(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE + || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)) + clear_entry = TRUE; + else + clear_entry = FALSE; + + change_folder_and_display_error (impl, location, clear_entry); +} + /* Creates the widgets for the shortcuts/bookmarks pane */ static GtkWidget * shortcuts_pane_create (GtkFileChooserDefault *impl, GtkSizeGroup *size_group) { impl->places_sidebar = gtk_places_sidebar_new (); + + g_signal_connect (impl->places_sidebar, "location-selected", + G_CALLBACK (places_sidebar_location_selected_cb), + impl); + return impl->places_sidebar; } -- 2.30.2